<?php 
require_once("../include/conn.php");
require_once("../include/page.php");
$table=$tb_dz;
$basesql=$title='';
if (isset($_GET['name'])) {
	$nname=$_REQUEST['name'];
}
if ($nname=='3') {//
	$basesql=' buid<8 ';
	$title='综合信息管理';
}elseif ($nname=='4'){//
	$basesql=' buid >9 and buid<19 ';
	$title='学习天地管理';
}elseif ($nname=='9'){//
	$basesql=' buid in(23,24) ';
	$title='任务图表管理';
}else {//
	self("参数不全!","admin_index.php");
}

$page=$_GET['page'];
$perpage=20;
$sql_all="select count(*) from   $table  where `isdel`='0'  and  $basesql ";
$con   =   mysql_db_query($db_name,$sql_all);   
$num   =   mysql_result($con,0);   //   统计当前总的记录数   
$list=new page($num,$page,$perpage);  
$strartrow=$list->getStartRow();
$sql   =   "select   *   from    $table  where `isdel`='0'  and  $basesql  order  by   id   DESC   limit $strartrow,$perpage";   //从上面的起点开始查询出20条数据   
$cn_ma   =   mysql_db_query($db_name,$sql); 
?>
<html>
<head>
<title><?php echo $title ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="Admin_Style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
</head>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%"  border="0" cellpadding="0" cellspacing="2">
  <tr class="topbg">
    <th colspan="6"><?php echo $title ?></th>
  </tr>
  <tr>
   <td width="3%">&nbsp;</td>
    <td width="36%">&nbsp;</td>
    <td width="15%">&nbsp;</td>
    <td width="12%">&nbsp;</td>
	<!--<td width="5%">&nbsp;</td>
    --><td width="13%">&nbsp;</td>
    <td width="21%">&nbsp;</td>
  </tr>
  <tr class="tdbg">
    <td>序号</td>
	<td>标题</td>
    <td>所属栏目</td>
    <td>滚动图片设置</td>
	<!--<td>显示</td>
    --><td>日期</td>
    <td>操作</td>
  </tr>
  <?php
  $i=1;
   while($row_ma = mysql_fetch_array($cn_ma)) {		
//   	dump($row_ma);
	$lmxx="select * from $tb_bm where id='".$row_ma[buid]."'";
	$lm_conn=mysql_query($lmxx);
	$ispicsql="select * from $tb_mp where bl_id ='".$row_ma[id]."'";
//	echo $ispicsql.'<br>';
	
	$ispiccn=mysql_query($ispicsql);
	$num=intval(mysql_affected_rows($db));
	if($num<=0){
		$ispicflag=false;
	}else{
		while($picrow=mysql_fetch_array($ispiccn)){ 
			if (isset($picrow['isshow'])) {
				$ispicflag=true;
				break;
			}
		}
	}
	?>
  <tr class="tdbg">
  	<td><?php echo $i; ?></td>
    <td><?php echo $msg ?><a href='/shownews.php?id=<?php echo $row_ma[id] ?>' target='_blank' ><?php echo substr_cut($row_ma[title],32); ?></a><?php if($row_ma[jian]==1){echo "<font color=red>&nbsp;&nbsp;&nbsp;动态</font>"; }?><?php if($row_ma[ishit]==1){echo "<font color=red>&nbsp;&nbsp;&nbsp;重要</font>"; }?></td>
    <td><?php if($lm_row=mysql_fetch_row($lm_conn)){  echo $lm_row[1]; }?></td>
	<td>
	<?php if ($ispicflag):
		?>
	<a href='modipics.php?id=<?php echo $row_ma[id] ?>' target='_blank' style="color:red" >设置</a>
	<?php else:
	?>
	设置
	<?php endif;
	?></td>
	<!--<td><?php 
	if($row_ma[isshow]==1) echo "显示";	
	else  echo "不显示";	
	?></td>
    --><td><?php
	 $row_ma[tdate]=substr(fendate($row_ma[tdate]),5);
		echo $row_ma[tdate];
?></td>
    <td>
    <a href="admin_xxtd.php?id=<?=$row_ma[id];?>&name=<?php echo $nname?>&action=update">修改</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <a href="Admin_del.php?id=<?=$row_ma[id];?>&action=delete&name=<?php echo $nname?>" title="删除了还可以从回收站找回来!">临时删除</a>&nbsp;&nbsp;&nbsp;&nbsp;
    <a href="Admin_del.php?id=<?=$row_ma[id];?>&action=pack&name=<?php echo $nname?>" title="千万要注意哟,删除了就找不回来了!">永久删除</a></td>
  </tr>
<?php
$i++;
 }?>  
<tr align="center">
  <td colspan="6" style="font-size:20px;"><?php echo $list->showPageList()?>  </td>
</tr>  
</table>
</body>
</html>